import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:调试方法：1、打断点  2、点那个“虫”  3、右键断点  可以设置条件  跳转到某变量等于几的情况
 * Date: 2023-10-28
 * Time:9:25
 */
public class test {
    //获取一个数二进制序列的偶数位和奇数位，并分别输出
    //从左边开始取  从右往左数
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        //取奇数序列  这个循环会进行16次
        for (int i = 30; i >= 0; i-=2) {
            System.out.print((n >>> i) & 1+ ' ');
        }
        System.out.println(' ');
        //得到偶数序列
        for (int i = 31; i >= 1; i-=2) {
            System.out.print((n >>> i) & 1 + ' ');
        }
    }

    //求水仙花数(一到六位数）
    //先得到这个数的位数，然后才能知道要几次方
    public static void main9(String[] args) {

        for (int i = 1; i < 9999999; i++) {
            int tmp = i;
            int cnt = 0;
            while (tmp != 0) {
                tmp /= 10;
                cnt ++;
            }
            //取出各个位的数字
            tmp = i;
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10,cnt);
                tmp /= 10;
            }
            if (sum == i) {
                System.out.println(i);
            }

        }
    }

    //求一个数二进制中1的个数
    //循环，每次右移一位，移动之后和1按位与，只要结果为1，cnt就+1
    public static void main8(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int cnt = 0;
        //移动31次
        for (int i = 1; i < 32; i++) {
            if ((a & 1) == 1) {
                cnt ++;
        }
            a = a >> 1;
        }
        System.out.println(cnt);
    }

    //模拟登录系统
    public static void main7(String[] args) {
        Scanner in = new Scanner(System.in);
        int cnt = 3;
        while (cnt != 0) {
            System.out.println("请输入密码，你还有" + cnt + "次机会");
            String password = in.nextLine();
            if (password.equals("1234")) {  //假设密码是1234
                System.out.println("登录成功");
                break;
            }
            else {
                System.out.println("密码错误");
                cnt --;
            }
        }
    }

    //打印x型图案！！
    public static void main6(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            for (int i = 0;i < a;i++) {
                for (int j = 0;j < a;j++) {
                    if (i == j) {
                        System.out.printf("%c",'*');
                    }
                    else if (i + j == a-1) {
                        System.out.printf("%c",'*');
                    }
                    else {
                        System.out.printf("%c",' ');
                    }
                }
                System.out.println();
            }
        }
    }


    //移位运算
    public static void main5(String[] args) {
        int a = 0x10;
        System.out.printf("%x\n",a << 1);
        // 运行结果(注意, 是按十六进制打印的)

    }

    //条件运算符
    public static void main4(String[] args) {
        int a = 10;
        int b = 20;
        int c = a < b? 1 : 2;
        System.out.println(c);
    }

    //输出乘法口诀表
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.printf("%d * %d = %d",i,j,i*j);
                System.out.printf(" ");
            }
            System.out.println();
        }
    }

    //编写代码模拟三次密码输入的场景。最多能输入三次密码，密码正确，提示“登录成功”,密码错误，
    //可以重新输入，最多输入三次。三次均错，则提示退出程序
    public static void main2(String[] args) {
        int cnt = 3;
        Scanner scanner = new Scanner(System.in);
        int code = 123456;
        int flag = 0;
        while(cnt > 0) {
            //咋输入一个字符串
            int input = scanner.nextInt();
            if (input != code) {
                System.out.println("输入错误，请重新输入");
                cnt --;
            }
            else {
                System.out.println("登录成功");
                flag = 1;
                break;
            }
        }
        if (flag == 0) {
            System.out.println("三次输入均错误，请退出程序");
        }
    }

    //分数求和
    public static void main1(String[] args) {
        double sum1 = 0,sum2 = 0;
        for (int i = 1; i <= 99; i+=2) {
            sum1 += 1.0/i;
        }
        for (int i = 2; i <= 100; i+=2) {
            sum2 += 1.0/i;
        }
        System.out.println(sum1 - sum2);
    }
}
